<template>
	<view class="components">
		<view class="result u-flex" :style="customstyle">
			<view class="timeBox">
				<view class="cm_title" style="margin: 0;">{{beginDate}}</view>
				<view class="cm_text">{{beginWeekday}}</view>
			</view>
			<view class="f1">
				<view class="cm_text">{{span}}</view>
				<view class="line"></view>
			</view>
			<view class="timeBox">
				<view class="cm_title" style="margin: 0;">{{endDate}}</view>
				<view class="cm_text">{{endWeekday}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import moment from 'moment'
	export default {
		name: "RentingTime",
		data() {
			return {
				beginDate: moment().format('YYYY-MM-DD'),
				beginWeekday: moment().format('dddd'),
				endDate: moment().add(7, 'days').format('YYYY-MM-DD'),
				endWeekday: moment().add(7, 'days').format('dddd'),
				span:'共7天'
			};
		},
		props: {
			customstyle: {
				type: String,
				default: "background:#f8f8f8"
			}
		}
	}
</script>

<style lang="scss" scoped>
	.components {
		.result {
			background-color: #f8f8f8;
			padding: 20rpx;
			border-radius: 12rpx;
			text-align: center;
			.cm_title {
				line-height: 2;
			}
			.line {
				width: 70%;
				height: 1rpx;
				background-color: #b4b4b4;

				margin: 0 auto;
				margin-top: 15rpx;
				margin-bottom: 15rpx;
				box-sizing: border-box;
			}
		}
	}
</style>
